﻿#region Usings

using System;
using System.Linq;
using System.Linq.Expressions;
using RailNet.Dao.Entity;

#endregion

namespace RailNet.Dao.Repository
{
    public interface IRepository<T> : IDisposable where T : class, IEntity
    {
        IQueryable<T> All();

        IQueryable<T> AllIncluding(params Expression<Func<T, object>>[] includeProperties);

        IQueryable<T> Filter(Expression<Func<T, bool>> predicate);

        IQueryable<T> Filter(Expression<Func<T, bool>> filter, int index = 0, int size = 50);

        T Find(params object[] keys);

        T Find(Expression<Func<T, bool>> predicate);
        
        T Create(T t);

        int Update(T t);

        int Delete(T t);
    }
}